﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="news_submit_addpic.aspx.cs" Inherits="Ccit.OA.NewsCenter.news_submit_addpic" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <style type="text/css">
    #imgPreview
    {
        filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
    }
    </style>

    <script language="javascript" type="text/javascript">
    <!--
        function doDelete()
        {
            if(confirm("是否确定删除导航图片？"))
            {
                var oPicId=document.getElementById("hdPicId").value;
                var oType=document.getElementById("hdType").value;
                var oId=document.getElementById("hdId").value;
                PageMethods.DeleteImage(oPicId,oId,oType,ClientCallBack);
            }
        }
        
        function ClientCallBack(oResult)
        {
            if(oResult)
            {
                alert("删除成功！");
                document.getElementById("hdPicId").value="";
                __doPostBack("likRefresh","");
                if(document.getElementById("hdRefreshOpener").value=="1")
                    eval("window.opener."+document.getElementById("hdFuncName").value+"()");
            }
            else
            {
                alert("删除失败，请稍后再试！");
            }
        }
        
        function doSelectImage()
        {
            var oImageUrl = document.getElementById("upImage").value;
            if(oImageUrl!="")
            {
                var imgPreview = document.getElementById("imgPreview");
                imgPreview.removeAttribute("src");
                imgPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src= oImageUrl;                
            }
        }
    //-->
    </script>
</head>
<body>
    <form id="form1" name="formImage" runat="server" >
        <input type="hidden" id="hdPicId" runat="server" />
        <input type="hidden" id="hdId" runat="server" />
        <input type="hidden" id="hdType" runat="server" />
        <%-- 是否要刷新Opener页面 0：不刷新 1：刷新--%>
        <input type="hidden" id="hdRefreshOpener" runat="server" />
        <%-- 执行刷新的方法名 --%>
        <input type="hidden" id="hdFuncName" runat="server" />
        <asp:LinkButton ID="likRefresh" runat="server" style="display:none" onclick="likRefresh_Click"></asp:LinkButton>
        <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"></asp:ScriptManager>
        <table class="tbToolbar" cellpadding="0" cellspacing="0" align="center" width="98%">
            <tr>
                <td align="left">
                    <div class="tbSeparator"></div>                    
                </td>
                <td align="left" class="titlebar" style="width:98%">
                    <nobr>信息提交-导航图片选择</nobr>
                </td>
                <td align="right">
                    <div class="tbSeparatorEnd"></div>
                </td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" align="center" width="98%" class="tableborder">
            <tr>
                <td align="right" style="width:80px" class="pformleft">
                    导航图片
                </td>
                <td class="pformright">
                    <%--<asp:FileUpload ID="upImage" onchange="doSelectImage()" Width="310px" runat="server" />--%>
                    <input type="file" id="upImage" runat="server" onchange="doSelectImage()" style="width:310px" />
                </td>
            </tr>
            <tr>
                <td align="right" class="pformright">
                    &nbsp;
                </td>
                <td class="pformright" align="center">
                    <asp:Button ID="btnUpLoad" runat="server" CssClass="button" Text="上传" onclick="btnUpLoad_Click" />&nbsp; 
                    <input type="button" id="btnDelete" runat="server" onclick="doDelete()" class="button" value="删除" />&nbsp;
                    <input type="button" id="btnClose" onclick="javascript:window.close()" runat="server" class="button" value="关闭" />
                </td>
            </tr>
            <tr>
                <td align="right" class="pformleft">
                    图片预览
                </td>
                <td class="pformright">
                    <%--<asp:Image ID="imgPreview" runat="server" Width="310" Height="210" />--%>
                    <div>
                    <img width="310" id="imgPreview" alt="" runat="server" height="210"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right">
                    &nbsp;
                </td>
                <td class="pformright" align="center">
                    最佳尺寸310*210px
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
